package service.imp;

import dao.imp.DaoLogicImp;
import javabean.Admin;
import javabean.House;
import service.ServiceLogic;
//业务逻辑层
public class ServiceLogicImp implements ServiceLogic {
    DaoLogicImp daoLogicImp=new DaoLogicImp();

    /**
     * 登录和验证码的业务逻辑
     * @return
     */

    /**
     * 1.添加房屋信息的业务逻辑
     * @param
     */
    @Override
    public void addService() {
        daoLogicImp.addDao();
    }


    /**
     * 2.查找房屋信息的业务逻辑
     * @param
     * @param
     * @return
     */
    @Override
    public House findService(int id) {
        House dao = daoLogicImp.findDao(id);
        return dao;
    }

    /**
     * 3.删除房屋信息
     * @param
     * @param
     * @return
     */
    @Override
    public Integer delService(int id) {
        House service = findService(id);
        if(service!=null){
            Integer integer = daoLogicImp.delDao(id);
            return integer;
        }
        return 0;
    }

    /**
     * 4.修改房屋信息的业务逻辑
     * @param
     * @param
     * @return
     */
    @Override
    public void updateService(int id) {
        daoLogicImp.updateDao(id);
    }

    /**
     * 5.房屋列表
     * @param
     */
    @Override
    public void listService() {
         daoLogicImp.listDao();
    }

    @Override
    public Admin adminService(String user, String password) {
        DaoLogicImp daoLogicImp = new DaoLogicImp();
        Admin admin = daoLogicImp.isAdmin(user, password);
        return admin;
    }
}
